var express = require('express');
var router = express.Router();
API = require('../models/API')
/* GET users listing. */
router.get('/', function(req, res, next) {
  res.send('respond with a resource');
});
router.get('/test', function (req, res, next) {
    function callback(error, response, body) {
        if (!error && response.statusCode == 200) {
            res.json(body);
        }
    }
    API.ajax.get(req , callback);
});
router.post('/login', function (req, res, next) {
    if(req.body['username'] === 'admin' && req.body['password'] === '123456'){
        res.json({
            code:1,
            msg:'登陆成功',
            data:{}
        })
    }else{
        res.json({
            code:0,
            msg:'登陆失败',
            data:{}
        })
    }
});
module.exports = router;
